<%--                                                                       --%>
<%-- Copyright (c) 2004 BroadVision, Inc.  All rights reserved.            --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<%
  String ctxPath = request.getContextPath();
%>

<script language="javascript">

function doPortletCreateEntity(portletId) {
  var action = '<c:url value="/ep/portletEntityNew.do"/>';
  if (action.indexOf("?") == -1) {
    action += "?";
  }
  action += "portletAppId=" + document.portletBrowseForm.portletAppId.value;
  action += "&portletId=" + portletId;

  document.portletBrowseForm.action = action;
  document.portletBrowseForm.submit();
}

function doPortletViewEntities(portletId) {
  var action = '<c:url value="/ep/portletEntityList.do"/>';
  if (action.indexOf("?") == -1) {
    action += "?";
  }
  action += "portletAppId=" + document.portletBrowseForm.portletAppId.value;
  action += "&portletId=" + portletId;

  document.portletBrowseForm.action = action;
  document.portletBrowseForm.submit();
}

<%@ include file="/mc/common/jsutils.jsp" %>

</script>
<c:set var="viewImg">
<img src="<%= ctxPath %>/ep/images/action/icon_view.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean:message key="image.alt.view.portlet.entities" bundle="ep.messages"/>" title="<bean:message key="image.alt.view.portlet.entities" bundle="ep.messages"/>">
</c:set>
<c:set var="addImg">
<img src="<%= ctxPath %>/ep/images/action/icon_createnew.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean:message key="image.alt.create.entity" bundle="ep.messages"/>" title="<bean:message key="image.alt.create.entity" bundle="ep.messages"/>">
</c:set>
<c:set var="portletAppId">
<%= request.getParameter("portletAppId") %>
</c:set>
<c:set var="serverId">
<%= request.getParameter("serverId") %>
</c:set>

<form name="portletBrowseForm" method="post">
<input type="hidden" name="portletId" value=""/>
<input type="hidden" name="portletAppId" value="<c:out value="${portletAppId}"/>"/>
<input type="hidden" name="serverId" value="<c:out value="${serverId}"/>"/>

<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">
      <div class="pageTitle">
      <bean:message key="ep.portlets.manage.page.title" bundle="ep.messages"/>
      </div>
      <div class="errorMessage"><html:errors bundle="ep.messages"/></div>
      <div>
      <%@include file="/mc/common/pagetab.jsp" %>
      </div>

      <div class="breadcrumb">
          <c:url var="portletAppUrl" value="/ep/portletAppBrowse.do">
            <c:param name="serverId" value="${serverId}"/>
	  </c:url>
          <a href="<c:out value="${portletAppUrl}"/>"><bean:message key="ep.portlet.app.server.root" bundle="ep.messages"/></a>
          <bean:message key="ep.breadcrumb.delimiter" bundle="ep.messages"/>
          <c:out value="${portletAppId}"/>
      </div>

      <div class="pageSubtitle">
        <span class="left"><bean:message key="ep.portlets" bundle="ep.messages"/></span>
        <span class="right"><input type="button" class="inputButton" value="<bean:message key="button.manage.portlet.entities" bundle="ep.messages"/>" onclick="doAction('/ep/portletEntityBrowse.do',document.portletAppInstallForm)"></span>
      </div>

      <table class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="Search result table" width="100%">
        <tr class="listHeader">
          <th id="Name" align="left"><bean:message key="ep.header.name.portlet" bundle="ep.messages"/></th>
          <th id="Description" align="left"><bean:message key="ep.header.description" bundle="ep.messages"/></th>
          <th id="Actions" align="left" nowrap><bean:message key="ep.header.actions" bundle="ep.messages"/></th>
        </tr>

        <!-- results -->

<logic:iterate id="item" name="list" indexId="index">
        <tr class="<%= index.intValue() % 2 == 0 ? "listEven" : "listOdd" %>">
          <c:url var="browseUrl" value="/ep/portletEntityList.do">
            <c:param name="portletId" value="${item.map.id}"/>
            <c:param name="portletAppId" value="${portletAppId}"/>
            <c:param name="serverId" value="${serverId}"/>
            <c:param name="portletDisplName" value="${item.map.name}"/> 
	  </c:url>
          <td headers="Name"><a href="<c:out value="${browseUrl}"/>"><bean:write
            name="item" property="name"/></a></td>
          <td headers="Description"><bean:write name="item" property="description"/></td>
          <td headers="Actions">
            <a href="#" onclick="doPortletCreateEntity('<c:out value="${item.map.id}"/>');"><c:out
            value='${addImg}' escapeXml="false"/></a>
            <a href="#" onclick="doPortletViewEntities('<c:out value="${item.map.id}"/>');"><c:out
            value='${viewImg}' escapeXml="false"/></a>
          </td>
        </tr>
</logic:iterate>

      </table>

      <!-- pagination -->
<%@ include file="/mc/common/pager.jsp" %>

    </td>
  </tr>
</table>
</form>
<form name="portletAppInstallForm" method="post">
</form>
